import pymysql 
DB_IP = '127.0.0.1'
DB_PORT = 3306
DB_USER = 'root'
DB_PWD = '123456'

class MySqlHelper(object):
    def __init__(self):
        self.connect = pymysql.Connect(host=DB_IP, port=DB_PORT, user=DB_USER, password=DB_PWD, database='jd_sku')
        cur = self.connect.cursor()
        if not cur:
            raise (NameError, "connect db fail")
        self.cursor = cur

    def exec_many(self,sql,param_list):
        if not self.connect.open:
            self.__init__()
        self.cursor.executemany(sql,param_list)
        self.connect.commit()
        self.connect.close()


    